using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class ICSaleQCBillEntryMap : EntityTypeConfiguration<ICSaleQCBillEntry>
    {
        public ICSaleQCBillEntryMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FInterID, t.FEntryID });

            // Properties
            this.Property(t => t.FBrNo)
                .IsRequired()
                .HasMaxLength(10);

            this.Property(t => t.FInterID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FEntryID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FQCItemNumber)
                .HasMaxLength(255);

            this.Property(t => t.FQCItemName)
                .HasMaxLength(255);

            this.Property(t => t.FQCUnit)
                .HasMaxLength(255);

            this.Property(t => t.FTargetValue)
                .HasMaxLength(80);

            this.Property(t => t.FLowerLimit)
                .HasMaxLength(80);

            this.Property(t => t.FUpperLimit)
                .HasMaxLength(80);

            this.Property(t => t.FNote)
                .HasMaxLength(255);

            this.Property(t => t.FQCInstrument)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FSchemeMemos)
                .HasMaxLength(255);

            this.Property(t => t.FTestValueText)
                .HasMaxLength(60);

            this.Property(t => t.FTargetText)
                .HasMaxLength(60);

            this.Property(t => t.FLowerLimitText)
                .HasMaxLength(60);

            this.Property(t => t.FUpperLimitText)
                .HasMaxLength(60);

            // Table & Column Mappings
            this.ToTable("ICSaleQCBillEntry");
            this.Property(t => t.FBrNo).HasColumnName("FBrNo");
            this.Property(t => t.FInterID).HasColumnName("FInterID");
            this.Property(t => t.FEntryID).HasColumnName("FEntryID");
            this.Property(t => t.FSourceEntryID).HasColumnName("FSourceEntryID");
            this.Property(t => t.FQCItemNumber).HasColumnName("FQCItemNumber");
            this.Property(t => t.FQCItemName).HasColumnName("FQCItemName");
            this.Property(t => t.FQCUnit).HasColumnName("FQCUnit");
            this.Property(t => t.FTargetValue).HasColumnName("FTargetValue");
            this.Property(t => t.FLowerLimit).HasColumnName("FLowerLimit");
            this.Property(t => t.FUpperLimit).HasColumnName("FUpperLimit");
            this.Property(t => t.FEmphasesCheck).HasColumnName("FEmphasesCheck");
            this.Property(t => t.FResult).HasColumnName("FResult");
            this.Property(t => t.FPassQty).HasColumnName("FPassQty");
            this.Property(t => t.FForOpScrapQty).HasColumnName("FForOpScrapQty");
            this.Property(t => t.FForMatScrapQty).HasColumnName("FForMatScrapQty");
            this.Property(t => t.FDisPassReason).HasColumnName("FDisPassReason");
            this.Property(t => t.FNote).HasColumnName("FNote");
            this.Property(t => t.FSampleQty).HasColumnName("FSampleQty");
            this.Property(t => t.FSamplePassQty).HasColumnName("FSamplePassQty");
            this.Property(t => t.FBadQty).HasColumnName("FBadQty");
            this.Property(t => t.FAnalysisMethodID).HasColumnName("FAnalysisMethodID");
            this.Property(t => t.FTargetID).HasColumnName("FTargetID");
            this.Property(t => t.FTargetQty).HasColumnName("FTargetQty");
            this.Property(t => t.FLowerLimitID).HasColumnName("FLowerLimitID");
            this.Property(t => t.FLowerLimitQty).HasColumnName("FLowerLimitQty");
            this.Property(t => t.FUpperLimitID).HasColumnName("FUpperLimitID");
            this.Property(t => t.FUpperLimitQty).HasColumnName("FUpperLimitQty");
            this.Property(t => t.FTestValueID).HasColumnName("FTestValueID");
            this.Property(t => t.FTestValue).HasColumnName("FTestValue");
            this.Property(t => t.FBillDate).HasColumnName("FBillDate");
            this.Property(t => t.FQCBasisID).HasColumnName("FQCBasisID");
            this.Property(t => t.FQCInstrument).HasColumnName("FQCInstrument");
            this.Property(t => t.FQCMethodID).HasColumnName("FQCMethodID");
            this.Property(t => t.FSampStdID).HasColumnName("FSampStdID");
            this.Property(t => t.FQCItemID).HasColumnName("FQCItemID");
            this.Property(t => t.FSchemeMemos).HasColumnName("FSchemeMemos");
            this.Property(t => t.FDefectID).HasColumnName("FDefectID");
            this.Property(t => t.FQCOtherID1).HasColumnName("FQCOtherID1");
            this.Property(t => t.FQCOtherID2).HasColumnName("FQCOtherID2");
            this.Property(t => t.FTestValue2).HasColumnName("FTestValue2");
            this.Property(t => t.FTestValueText).HasColumnName("FTestValueText");
            this.Property(t => t.FTargetText).HasColumnName("FTargetText");
            this.Property(t => t.FLowerLimitText).HasColumnName("FLowerLimitText");
            this.Property(t => t.FUpperLimitText).HasColumnName("FUpperLimitText");
            this.Property(t => t.FQCInstrumentID).HasColumnName("FQCInstrumentID");
            this.Property(t => t.FLowTolerance).HasColumnName("FLowTolerance");
            this.Property(t => t.FUpTolerance).HasColumnName("FUpTolerance");
        }
    }
}
